<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="theme-color" content="#0078E7"><meta name="author" content="呆航"><meta name="copyright" content="呆航"><meta name="generator" content="Hexo 5.2.0"><meta name="theme" content="hexo-theme-yun"><title>开发一个自动打卡程序 | 呆航的小站</title><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@900&amp;display=swap" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/star-markdown-css@0.1.25/dist/yun/yun-markdown.min.css"><script src="//at.alicdn.com/t/font_1140697_dxory92pb0h.js" async></script><script src="https://cdn.jsdelivr.net/npm/scrollreveal/dist/scrollreveal.min.js" defer></script><script>function initScrollReveal() {
  [".post-card",".post-content img"].forEach((target)=> {
    ScrollReveal().reveal(target);
  })
}
document.addEventListener("DOMContentLoaded", initScrollReveal);
document.addEventListener("pjax:success", initScrollReveal);
</script><link id="light-prism-css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@latest/themes/prism.css" media="(prefers-color-scheme: light)"><link id="dark-prism-css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@latest/themes/prism-tomorrow.css" media="(prefers-color-scheme: dark)"><link rel="icon" type="image/svg+xml" href="/yun.svg"><link rel="mask-icon" href="/yun.svg" color="#0078E7"><link rel="preload" href="/css/hexo-theme-yun.css" as="style"><link rel="preload" href="/js/utils.js" as="script"><link rel="preload" href="/js/hexo-theme-yun.js" as="script"><link rel="prefetch" href="/js/sidebar.js" as="script"><link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin><script id="yun-config">
    const Yun = window.Yun || {};
    window.CONFIG = {"hostname":"lqh827821562.gitee.io","root":"/","title":"呆航的小站","version":"1.7.0","mode":"auto","copycode":true,"page":{"isPost":true},"i18n":{"placeholder":"搜索...","empty":"找不到您查询的内容: ${query}","hits":"找到 ${hits} 条结果","hits_time":"找到 ${hits} 条结果（用时 ${time} 毫秒）"},"anonymous_image":"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/avatar/none.jpg","say":{"api":"https://v1.hitokoto.cn","hitokoto":true},"algolia":{"appID":"E0XRZBP9EC","apiKey":"014277189b8673da64c5c3a931019c0e","indexName":"blog","hits":{"per_page":10}},"fireworks":{"colors":["102, 167, 221","62, 131, 225","33, 78, 194"]}};
  </script><link rel="stylesheet" href="/css/hexo-theme-yun.css"><script src="/js/utils.js"></script><script src="/js/hexo-theme-yun.js"></script><link rel="alternate" href="/atom.xml" title="呆航的小站" type="application/atom+xml"><link rel="preconnect" href="https://www.google-analytics.com" crossorigin><script async src="https://www.googletagmanager.com/gtag/js?id=UA-121354150-1"></script><script>if (CONFIG.hostname === location.hostname) {
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'UA-121354150-1');
}</script><script data-ad-client="ca-pub-2245427233262012" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><script>(function(){
  var bp = document.createElement('script');
  var curProtocol = window.location.protocol.split(':')[0];
  if (curProtocol === 'https') {
    bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
  }
  else {
    bp.src = 'http://push.zhanzhang.baidu.com/push.js';
  }
  var s = document.getElementsByTagName("script")[0];
  s.parentNode.insertBefore(bp, s);
})();</script><!-- Google Tag Manager --><script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-M9KWR9L');</script><!-- End Google Tag Manager --><meta name="description" content="准备阶段手机点开开发者模式（多次点击手机版本号），然后在系统与更新中点击开发者选项，进入打开USB调试，和电脑连接，看到设备即成功在手机厂商得连接软件中连接，自动下载驱动，在设备管理器中看到有这个即成功安装完成后在cmd输入adb devices没有报错，但是还没发现我的设备将手机的VID添加到C:\Users\admin\.android目录下的adb_usb.ini文件里，手机的vid可以在设">
<meta property="og:type" content="article">
<meta property="og:title" content="开发一个自动打卡程序">
<meta property="og:url" content="http://lqh827821562.gitee.io/%E5%BC%80%E5%8F%91%E4%B8%80%E4%B8%AA%E8%87%AA%E5%8A%A8%E6%89%93%E5%8D%A1%E7%A8%8B%E5%BA%8F/index.html">
<meta property="og:site_name" content="呆航的小站">
<meta property="og:description" content="准备阶段手机点开开发者模式（多次点击手机版本号），然后在系统与更新中点击开发者选项，进入打开USB调试，和电脑连接，看到设备即成功在手机厂商得连接软件中连接，自动下载驱动，在设备管理器中看到有这个即成功安装完成后在cmd输入adb devices没有报错，但是还没发现我的设备将手机的VID添加到C:\Users\admin\.android目录下的adb_usb.ini文件里，手机的vid可以在设">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://z3.ax1x.com/2021/11/06/IlKf1O.png">
<meta property="og:image" content="https://z3.ax1x.com/2021/11/06/IlQgSK.png">
<meta property="og:image" content="https://z3.ax1x.com/2021/11/06/IlMeu4.png">
<meta property="og:image" content="https://z3.ax1x.com/2021/11/06/IlMgbj.png">
<meta property="og:image" content="https://z3.ax1x.com/2021/11/06/IlQ7fP.png">
<meta property="og:image" content="https://z3.ax1x.com/2021/11/13/IrosmR.png">
<meta property="article:published_time" content="2021-11-06T15:16:13.000Z">
<meta property="article:modified_time" content="2021-11-27T15:08:35.069Z">
<meta property="article:author" content="呆航">
<meta property="article:tag" content="便利">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://z3.ax1x.com/2021/11/06/IlKf1O.png"><script src="/js/ui/mode.js"></script></head><body><script defer src="https://cdn.jsdelivr.net/npm/animejs@latest"></script><script defer src="/js/ui/fireworks.js"></script><canvas class="fireworks"></canvas><div class="container"><a class="sidebar-toggle hty-icon-button" id="menu-btn"><div class="hamburger hamburger--spin" type="button"><span class="hamburger-box"><span class="hamburger-inner"></span></span></div></a><div class="sidebar-toggle sidebar-overlay"></div><aside class="sidebar"><script src="/js/sidebar.js"></script><ul class="sidebar-nav"><li class="sidebar-nav-item sidebar-nav-toc hty-icon-button sidebar-nav-active" data-target="post-toc-wrap" title="文章目录"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-list-ordered"></use></svg></li><li class="sidebar-nav-item sidebar-nav-overview hty-icon-button" data-target="site-overview-wrap" title="站点概览"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-passport-line"></use></svg></li></ul><div class="sidebar-panel" id="site-overview-wrap"><div class="site-info fix-top"><a class="site-author-avatar" href="/about/" title="呆航"><img width="96" loading="lazy" src="/images/avatar.png" alt="呆航"><span class="site-author-status" title="Looking for dawn.">🌑</span></a><div class="site-author-name"><a href="/about/">呆航</a></div><span class="site-name">呆航的小站</span><sub class="site-subtitle">All at sea.</sub><div class="site-desciption">希望能成为一个有趣的人</div></div><nav class="site-state"><a class="site-state-item hty-icon-button icon-home" href="/" title="首页"><span class="site-state-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-home-4-line"></use></svg></span></a><div class="site-state-item"><a href="/archives/" title="归档"><span class="site-state-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-archive-line"></use></svg></span><span class="site-state-item-count">42</span></a></div><div class="site-state-item"><a href="/categories/" title="分类"><span class="site-state-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-folder-2-line"></use></svg></span><span class="site-state-item-count">2</span></a></div><div class="site-state-item"><a href="/tags/" title="标签"><span class="site-state-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-price-tag-3-line"></use></svg></span><span class="site-state-item-count">9</span></a></div><a class="site-state-item hty-icon-button" target="_blank" rel="noopener" href="https://yun.yunyoujun.cn" title="文档"><span class="site-state-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-settings-line"></use></svg></span></a></nav><hr style="margin-bottom:0.5rem"><div class="links-of-author"><a class="links-of-author-item hty-icon-button" rel="noopener" href="tencent://message/?uin=827821562&amp;site=qq&amp;menu=yes" title="QQ" target="_blank" style="color:#12B7F5"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-qq-line"></use></svg></a></div><hr style="margin:0.5rem 1rem"><div class="links"><a class="links-item hty-icon-button" href="/links/" title="我的小伙伴们" style="color:dodgerblue"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-genderless-line"></use></svg></a></div><br><a class="links-item hty-icon-button" id="toggle-mode-btn" href="javascript:;" title="Mode" style="color: #f1cb64"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-contrast-2-line"></use></svg></a></div><div class="sidebar-panel sidebar-panel-active" id="post-toc-wrap"><div class="post-toc"><div class="post-toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%87%86%E5%A4%87%E9%98%B6%E6%AE%B5"><span class="toc-number">1.</span> <span class="toc-text">准备阶段</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BB%A3%E7%A0%81%EF%BC%88%E4%BC%AA%E8%87%AA%E5%8A%A8%E6%89%93%E5%8D%A1%EF%BC%89"><span class="toc-number">2.</span> <span class="toc-text">代码（伪自动打卡）</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BB%A3%E7%A0%81%EF%BC%881%E6%AC%A1%E6%94%B9%E8%BF%9B%EF%BC%89"><span class="toc-number">3.</span> <span class="toc-text">代码（1次改进）</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BB%A3%E7%A0%81%EF%BC%882%E6%AC%A1%E6%94%B9%E8%BF%9B%EF%BC%89"><span class="toc-number">4.</span> <span class="toc-text">代码（2次改进）</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%A6%82%E4%BD%95%E8%87%AA%E5%8A%A8%E6%89%93%E5%8D%A1"><span class="toc-number">4.1.</span> <span class="toc-text">如何自动打卡</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BB%A3%E7%A0%81%EF%BC%883%E6%AC%A1%E6%94%B9%E8%BF%9B%EF%BC%89"><span class="toc-number">5.</span> <span class="toc-text">代码（3次改进）</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E6%9C%AA%E7%9F%A5%E7%8A%B6%E5%86%B5%E8%AE%B0%E5%BD%95"><span class="toc-number">6.</span> <span class="toc-text">未知状况记录</span></a></li></ol></div></div></div></aside><main class="sidebar-translate" id="content"><div id="post"><article class="hty-card post-block" itemscope itemtype="https://schema.org/Article"><link itemprop="mainEntityOfPage" href="http://lqh827821562.gitee.io/%E5%BC%80%E5%8F%91%E4%B8%80%E4%B8%AA%E8%87%AA%E5%8A%A8%E6%89%93%E5%8D%A1%E7%A8%8B%E5%BA%8F/"><span hidden itemprop="author" itemscope itemtype="https://schema.org/Person"><meta itemprop="name" content="呆航"><meta itemprop="description"></span><span hidden itemprop="publisher" itemscope itemtype="https://schema.org/Organization"><meta itemprop="name" content="呆航的小站"></span><header class="post-header"><h1 class="post-title" itemprop="name headline">开发一个自动打卡程序</h1><div class="post-meta"><div class="post-time" style="display:block"><span class="post-meta-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-calendar-line"></use></svg></span> <time title="创建时间：2021-11-06 23:16:13" itemprop="dateCreated datePublished" datetime="2021-11-06T23:16:13+08:00">2021-11-06</time><span class="post-meta-divider">-</span><span class="post-meta-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-calendar-2-line"></use></svg></span> <time title="修改时间：2021-11-27 23:08:35" itemprop="dateModified" datetime="2021-11-27T23:08:35+08:00">2021-11-27</time></div><span class="post-count"><span class="post-symbolcount"><span class="post-meta-item-icon" title="本文字数"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-file-word-line"></use></svg></span> <span title="本文字数">2.4k</span><span class="post-meta-divider">-</span><span class="post-meta-item-icon" title="阅读时长"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-timer-line"></use></svg></span> <span title="阅读时长">9m</span></span></span><span class="post-busuanzi"><span class="post-meta-divider">-</span><span class="post-meta-item-icon" title="阅读次数"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-eye-line"></use></svg> <span id="busuanzi_value_page_pv"></span></span></span><div class="post-classify"><span class="post-tag"><a class="tag-item" href="/tags/%E4%BE%BF%E5%88%A9/" style="--text-color:dimgray"><span class="post-meta-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-price-tag-3-line"></use></svg></span><span class="tag-name">便利</span></a></span></div></div></header><section class="post-body" itemprop="articleBody"><div class="post-content markdown-body" style="--smc-primary:#0078E7;"><h1 id="准备阶段"><a href="#准备阶段" class="headerlink" title="准备阶段"></a>准备阶段</h1><p>手机点开开发者模式（多次点击手机版本号），然后在系统与更新中点击开发者选项，进入打开USB调试，和电脑连接，看到设备即成功<br><a target="_blank" rel="noopener" href="https://imgtu.com/i/IlKf1O"><img src="https://z3.ax1x.com/2021/11/06/IlKf1O.png" alt="IlKf1O.png" loading="lazy"></a><br>在手机厂商得连接软件中连接，自动下载驱动，在设备管理器中看到有这个即成功<br><a target="_blank" rel="noopener" href="https://imgtu.com/i/IlQgSK"><img src="https://z3.ax1x.com/2021/11/06/IlQgSK.png" alt="IlQgSK.png" loading="lazy"></a><br>安装完成后在cmd输入<code>adb devices</code>没有报错，但是还没发现我的设备<br><a target="_blank" rel="noopener" href="https://imgtu.com/i/IlMeu4"><img src="https://z3.ax1x.com/2021/11/06/IlMeu4.png" alt="IlMeu4.png" loading="lazy"></a><br>将手机的VID添加到C:\Users\admin\.android目录下的adb_usb.ini文件里，手机的vid可以在设别管理器中点击手机得属性右键详细信息属性硬件ID中得到，PID_后面四个即ID，格式为<code>0x</code>然后跟ID<br><a target="_blank" rel="noopener" href="https://imgtu.com/i/IlMgbj"><img src="https://z3.ax1x.com/2021/11/06/IlMgbj.png" alt="IlMgbj.png" loading="lazy"></a><br>重新输入<code>adb devices</code>看到手机即成功<br><a target="_blank" rel="noopener" href="https://imgtu.com/i/IlQ7fP"><img src="https://z3.ax1x.com/2021/11/06/IlQ7fP.png" alt="IlQ7fP.png" loading="lazy"></a>  </p>
<h1 id="代码（伪自动打卡）"><a href="#代码（伪自动打卡）" class="headerlink" title="代码（伪自动打卡）"></a>代码（伪自动打卡）</h1><p>为什么是伪，因为这个自动打卡有一个前提，那就是手机必须用usb连接电脑，然后用python执行，py可以设置自动执行，但是手机先连电脑是硬伤</p>
<pre class="language-python" data-language="python"><code class="language-python"><span class="token keyword">import</span> os<span class="token punctuation">,</span>re
<span class="token keyword">import</span> time
<span class="token keyword">import</span> uiautomator2 <span class="token keyword">as</span> u2
 
 
<span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string">"--------------------编写函数----------------------"</span><span class="token punctuation">)</span>
<span class="token comment">##根据x和y坐标进行屏幕定位点击事件</span>
<span class="token keyword">def</span> <span class="token function">onClick</span><span class="token punctuation">(</span>x<span class="token punctuation">,</span>y<span class="token punctuation">)</span><span class="token punctuation">:</span>
    <span class="token comment">##触摸屏幕进行点击</span>
    os<span class="token punctuation">.</span>system<span class="token punctuation">(</span><span class="token string">'adb shell input tap &#123;x1&#125; &#123;y1&#125;'</span><span class="token punctuation">.</span><span class="token builtin">format</span><span class="token punctuation">(</span>x1<span class="token operator">=</span>x<span class="token punctuation">,</span> y1<span class="token operator">=</span>y<span class="token punctuation">)</span><span class="token punctuation">)</span>
 
<span class="token comment">##滑动屏幕从(x, y)坐标点到(ex, ey)坐标点</span>
<span class="token keyword">def</span> <span class="token function">slide</span><span class="token punctuation">(</span>x<span class="token punctuation">,</span>y<span class="token punctuation">,</span>ex<span class="token punctuation">,</span>ey<span class="token punctuation">)</span><span class="token punctuation">:</span>
    os<span class="token punctuation">.</span>system<span class="token punctuation">(</span><span class="token string">'adb shell input swipe &#123;x1&#125; &#123;y1&#125; &#123;x2&#125; &#123;y2&#125;'</span><span class="token punctuation">.</span><span class="token builtin">format</span><span class="token punctuation">(</span>x1<span class="token operator">=</span>x<span class="token punctuation">,</span> y1<span class="token operator">=</span>y<span class="token punctuation">,</span> x2<span class="token operator">=</span>ex<span class="token punctuation">,</span> y2<span class="token operator">=</span>ey<span class="token punctuation">)</span><span class="token punctuation">)</span>
 
<span class="token comment">##手机屏幕响应操作</span>
<span class="token keyword">def</span> <span class="token function">touch</span><span class="token punctuation">(</span>key<span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token comment">#按动相应的按键</span>
    <span class="token keyword">if</span> key <span class="token operator">==</span> <span class="token string">"back"</span><span class="token punctuation">:</span>
        <span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string">"> 返回按键"</span><span class="token punctuation">)</span>
        os<span class="token punctuation">.</span>system<span class="token punctuation">(</span><span class="token string">'adb shell input keyevent 4'</span><span class="token punctuation">)</span>
    <span class="token keyword">elif</span> key <span class="token operator">==</span> <span class="token string">"light"</span><span class="token punctuation">:</span>
        <span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string">"> 开屏按键"</span><span class="token punctuation">)</span>
        os<span class="token punctuation">.</span>system<span class="token punctuation">(</span><span class="token string">'adb shell input keyevent 26'</span><span class="token punctuation">)</span>
    time<span class="token punctuation">.</span>sleep<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span> <span class="token comment"># 等待1s等手机反应</span>
 
<span class="token comment">##判断是否黑屏</span>
<span class="token keyword">def</span> <span class="token function">is_black</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
    d <span class="token operator">=</span> u2<span class="token punctuation">.</span>connect<span class="token punctuation">(</span><span class="token punctuation">)</span>
    screen <span class="token operator">=</span> d<span class="token punctuation">.</span>info
    <span class="token keyword">if</span> screen<span class="token punctuation">[</span><span class="token string">"screenOn"</span><span class="token punctuation">]</span> <span class="token operator">==</span> <span class="token boolean">False</span><span class="token punctuation">:</span>
        <span class="token keyword">return</span> <span class="token boolean">True</span>
        <span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string">"熄屏状态..."</span><span class="token punctuation">)</span>
<span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string">"----------------------------------------------------------"</span><span class="token punctuation">)</span>
<span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string">"---------------编写主函数，开始调用执行打卡---------------"</span><span class="token punctuation">)</span>
<span class="token comment">#不管手机在哪个页面，切换到我app所在页面</span>
<span class="token keyword">def</span> <span class="token function">find</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
    os<span class="token punctuation">.</span>system<span class="token punctuation">(</span><span class="token string">"adb shell input keyevent 3"</span><span class="token punctuation">)</span>
    time<span class="token punctuation">.</span>sleep<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span>
    <span class="token keyword">for</span> i <span class="token keyword">in</span> <span class="token builtin">range</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
        slide<span class="token punctuation">(</span><span class="token number">1000</span><span class="token punctuation">,</span><span class="token number">1000</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">1000</span><span class="token punctuation">)</span>
        time<span class="token punctuation">.</span>sleep<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span>
    slide<span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">1000</span><span class="token punctuation">,</span><span class="token number">1000</span><span class="token punctuation">,</span><span class="token number">1000</span><span class="token punctuation">)</span>
    time<span class="token punctuation">.</span>sleep<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span>
<span class="token keyword">def</span> <span class="token function">start</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
    <span class="token comment">##1、点击屏幕智慧曲园，坐标可根据手机自行调节</span>
    onClick<span class="token punctuation">(</span><span class="token number">650</span><span class="token punctuation">,</span><span class="token number">850</span><span class="token punctuation">)</span>
    time<span class="token punctuation">.</span>sleep<span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">)</span>
    <span class="token comment">##2、切换到日常</span>
    onClick<span class="token punctuation">(</span><span class="token number">400</span><span class="token punctuation">,</span><span class="token number">2200</span><span class="token punctuation">)</span>
    time<span class="token punctuation">.</span>sleep<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span>
    <span class="token comment">##3、滑动屏幕使打卡显示在屏幕上</span>
    slide<span class="token punctuation">(</span><span class="token number">400</span><span class="token punctuation">,</span><span class="token number">1000</span><span class="token punctuation">,</span><span class="token number">400</span><span class="token punctuation">,</span><span class="token number">500</span><span class="token punctuation">)</span>
    time<span class="token punctuation">.</span>sleep<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span>
    <span class="token comment">##4、点击打卡按钮</span>
    onClick<span class="token punctuation">(</span><span class="token number">200</span><span class="token punctuation">,</span><span class="token number">1800</span><span class="token punctuation">)</span>
    time<span class="token punctuation">.</span>sleep<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span>
    <span class="token comment">##5、滑动屏幕找提交</span>
    slide<span class="token punctuation">(</span><span class="token number">400</span><span class="token punctuation">,</span><span class="token number">2000</span><span class="token punctuation">,</span><span class="token number">400</span><span class="token punctuation">,</span><span class="token number">500</span><span class="token punctuation">)</span>
    time<span class="token punctuation">.</span>sleep<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span>
    slide<span class="token punctuation">(</span><span class="token number">400</span><span class="token punctuation">,</span><span class="token number">2000</span><span class="token punctuation">,</span><span class="token number">400</span><span class="token punctuation">,</span><span class="token number">500</span><span class="token punctuation">)</span>
    time<span class="token punctuation">.</span>sleep<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span>
    <span class="token comment">##6、点击提交</span>
    onClick<span class="token punctuation">(</span><span class="token number">400</span><span class="token punctuation">,</span><span class="token number">2200</span><span class="token punctuation">)</span>
    time<span class="token punctuation">.</span>sleep<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span>
    touch<span class="token punctuation">(</span><span class="token string">"light"</span><span class="token punctuation">)</span>
 
<span class="token keyword">def</span> <span class="token function">startMain</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
    <span class="token keyword">if</span> is_black<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
        touch<span class="token punctuation">(</span><span class="token string">"light"</span><span class="token punctuation">)</span> <span class="token comment">##点击亮屏幕</span>
        <span class="token comment">##由于我的是密码锁屏，姑且要输入密码</span>
        <span class="token comment">##如果将密码锁去掉则可以注释掉一下代码了，只需要亮屏即可</span>
        slide<span class="token punctuation">(</span><span class="token number">400</span><span class="token punctuation">,</span><span class="token number">2000</span><span class="token punctuation">,</span><span class="token number">400</span><span class="token punctuation">,</span><span class="token number">500</span><span class="token punctuation">)</span>
        onClick<span class="token punctuation">(</span><span class="token number">400</span><span class="token punctuation">,</span><span class="token number">1800</span><span class="token punctuation">)</span>
        onClick<span class="token punctuation">(</span><span class="token number">400</span><span class="token punctuation">,</span><span class="token number">1200</span><span class="token punctuation">)</span>
        onClick<span class="token punctuation">(</span><span class="token number">400</span><span class="token punctuation">,</span><span class="token number">1800</span><span class="token punctuation">)</span>
        onClick<span class="token punctuation">(</span><span class="token number">200</span><span class="token punctuation">,</span><span class="token number">1500</span><span class="token punctuation">)</span>
        onClick<span class="token punctuation">(</span><span class="token number">400</span><span class="token punctuation">,</span><span class="token number">1800</span><span class="token punctuation">)</span>
        onClick<span class="token punctuation">(</span><span class="token number">200</span><span class="token punctuation">,</span><span class="token number">1700</span><span class="token punctuation">)</span>
        find<span class="token punctuation">(</span><span class="token punctuation">)</span>
        start<span class="token punctuation">(</span><span class="token punctuation">)</span>
    <span class="token keyword">else</span><span class="token punctuation">:</span>
        find<span class="token punctuation">(</span><span class="token punctuation">)</span>
        start<span class="token punctuation">(</span><span class="token punctuation">)</span>
 
 
startMain<span class="token punctuation">(</span><span class="token punctuation">)</span>

</code></pre>
<p>以上述代码为样本，进行改编，坐标可以在cmd中使用命令<code>adb shell input tap 650 850</code>进行获取，<br>缺点：移植性为0，换手机即不能运行，操作麻烦，必须每天手动去连接手机电脑</p>
<h1 id="代码（1次改进）"><a href="#代码（1次改进）" class="headerlink" title="代码（1次改进）"></a>代码（1次改进）</h1><p>1次改进以后可以脱离手机进行打卡,原理依旧是模拟点击，但是提前安装好安卓模拟器并且在模拟器中安装好要打卡的程序，最后写好代码添加到计划任务中  </p>
<pre class="language-python" data-language="python"><code class="language-python"><span class="token keyword">from</span> pymouse <span class="token keyword">import</span> <span class="token operator">*</span>
<span class="token keyword">from</span> pykeyboard <span class="token keyword">import</span> <span class="token operator">*</span>
<span class="token keyword">from</span> pyperclip <span class="token keyword">import</span> <span class="token operator">*</span>
<span class="token keyword">from</span> time <span class="token keyword">import</span> sleep
<span class="token keyword">from</span> pyautogui <span class="token keyword">import</span> <span class="token operator">*</span>
mouse<span class="token operator">=</span>PyMouse<span class="token punctuation">(</span><span class="token punctuation">)</span>
k <span class="token operator">=</span> PyKeyboard<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token comment">#先点击一次桌面，防止睡觉前页面不在桌面</span>
mouse<span class="token punctuation">.</span>click<span class="token punctuation">(</span><span class="token number">2200</span><span class="token punctuation">,</span><span class="token number">1600</span><span class="token punctuation">)</span>
sleep<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span>
<span class="token comment">#点击桌面的雷电模拟器</span>
mouse<span class="token punctuation">.</span>click<span class="token punctuation">(</span><span class="token number">35</span><span class="token punctuation">,</span><span class="token number">250</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">)</span>
<span class="token comment">#等待15s确保模拟器打开</span>
sleep<span class="token punctuation">(</span><span class="token number">15</span><span class="token punctuation">)</span>
<span class="token comment">#点击模拟器桌面的智慧曲园</span>
mouse<span class="token punctuation">.</span>click<span class="token punctuation">(</span><span class="token number">1000</span><span class="token punctuation">,</span><span class="token number">220</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">)</span>
<span class="token comment">#等待打开</span>
sleep<span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span>
<span class="token comment">#点击日常</span>
mouse<span class="token punctuation">.</span>click<span class="token punctuation">(</span><span class="token number">900</span><span class="token punctuation">,</span><span class="token number">1000</span><span class="token punctuation">)</span>
<span class="token comment">#向下移动看到打卡页面</span>
moveTo<span class="token punctuation">(</span><span class="token number">900</span><span class="token punctuation">,</span> <span class="token number">600</span><span class="token punctuation">,</span> <span class="token number">0.5</span><span class="token punctuation">)</span>
dragRel<span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token operator">-</span><span class="token number">500</span><span class="token punctuation">,</span> <span class="token number">0.5</span><span class="token punctuation">)</span>
<span class="token comment">#点击打卡</span>
mouse<span class="token punctuation">.</span>click<span class="token punctuation">(</span><span class="token number">800</span><span class="token punctuation">,</span><span class="token number">850</span><span class="token punctuation">)</span>
sleep<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span>
<span class="token comment">#切换到早上打卡</span>
mouse<span class="token punctuation">.</span>click<span class="token punctuation">(</span><span class="token number">800</span><span class="token punctuation">,</span><span class="token number">200</span><span class="token punctuation">)</span>
<span class="token comment">#循环四次拉动屏幕到最下</span>
<span class="token keyword">for</span> i <span class="token keyword">in</span> <span class="token builtin">range</span><span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
    moveTo<span class="token punctuation">(</span><span class="token number">900</span><span class="token punctuation">,</span><span class="token number">800</span><span class="token punctuation">,</span><span class="token number">0.5</span><span class="token punctuation">)</span>
    dragRel<span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token operator">-</span><span class="token number">800</span><span class="token punctuation">,</span> <span class="token number">0.5</span><span class="token punctuation">)</span>
<span class="token comment">#点击提交</span>
mouse<span class="token punctuation">.</span>click<span class="token punctuation">(</span><span class="token number">900</span><span class="token punctuation">,</span><span class="token number">950</span><span class="token punctuation">)</span>
</code></pre>
<p>缺点：移植性几乎没有，甚至会伴随你下载程序到桌面而影响程序的打开，为了保证计划任务顺利执行，需要设置不进入睡眠状态</p>
<h1 id="代码（2次改进）"><a href="#代码（2次改进）" class="headerlink" title="代码（2次改进）"></a>代码（2次改进）</h1><p>如果想要客服1次改进的缺点，就务必不能选择使用模拟点击的方式来完成自动打卡，经过研究发现，app发送打卡信息本质上还是一种网页的访问（起码我需要的这个是这样的），发送一个json给服务器，服务器验证以后发回打卡成功的信息。<br>经过两天的研究（主要是打卡限制12点前进行，12点后我没法继续去获得json研究），我发现了整个签到过程分为两部分，第一部分是使用cookies作为身份验证，确定打卡者身份，第二部分是打卡，为了保证可以完成自动打卡，所以写出的脚本应当包括账号密码，使用自己的账号密码信息去登录以获取cookies，再进行打卡</p>
<pre class="language-python" data-language="python"><code class="language-python"><span class="token keyword">import</span> re
<span class="token keyword">import</span> requests
<span class="token keyword">import</span> os
<span class="token keyword">import</span> time
<span class="token keyword">import</span> sys
<span class="token keyword">import</span> json
headers <span class="token operator">=</span> <span class="token punctuation">&#123;</span>
    <span class="token string">'user-agent'</span><span class="token punctuation">:</span> <span class="token string">'Dart/2.13 (dart:io)'</span><span class="token punctuation">,</span>
    <span class="token string">'content-type'</span><span class="token punctuation">:</span><span class="token string">'application/json; charset=utf-8'</span><span class="token punctuation">,</span>
    <span class="token string">'accept-encoding'</span><span class="token punctuation">:</span><span class="token string">'gzip'</span>
    <span class="token punctuation">&#125;</span>
<span class="token comment">#此处放入你的账号密码等登录信息，值得注意的是需要确保和登陆的json一致，因为漏了一个其他的键值对浪费了一个小时时间</span>
user <span class="token operator">=</span> <span class="token punctuation">&#123;</span><span class="token punctuation">&#125;</span>
<span class="token comment"># 这里放入打卡信息，具体内容请自行拦截json</span>
info <span class="token operator">=</span> <span class="token punctuation">&#123;</span><span class="token punctuation">&#125;</span>
<span class="token comment">#以下两个url分别指向登录网页和打卡网页，具体可以在拦截的请求包中host+最上层的路径组合，这里为了保护个人隐私，将其删去</span>
login_url <span class="token operator">=</span> <span class="token string">""</span>
health_url <span class="token operator">=</span> <span class="token string">""</span>
session <span class="token operator">=</span> requests<span class="token punctuation">.</span>session<span class="token punctuation">(</span><span class="token punctuation">)</span>
login <span class="token operator">=</span> session<span class="token punctuation">.</span>post<span class="token punctuation">(</span>login_url<span class="token punctuation">,</span> json <span class="token operator">=</span> user<span class="token punctuation">,</span> headers <span class="token operator">=</span> headers<span class="token punctuation">)</span>
cookies <span class="token operator">=</span> session<span class="token punctuation">.</span>cookies<span class="token punctuation">.</span>get_dict<span class="token punctuation">(</span><span class="token punctuation">)</span>
health <span class="token operator">=</span> session<span class="token punctuation">.</span>post<span class="token punctuation">(</span>health_url<span class="token punctuation">,</span> json <span class="token operator">=</span> info<span class="token punctuation">,</span> headers <span class="token operator">=</span> headers<span class="token punctuation">)</span>
<span class="token comment">#这里做一份日志，主要是在写程序初期写错了上面的url，进行调试，后期干脆保留日志</span>
log <span class="token operator">=</span> <span class="token string">"./log.txt"</span>
<span class="token keyword">with</span> <span class="token builtin">open</span><span class="token punctuation">(</span>log<span class="token punctuation">,</span> <span class="token string">"a"</span><span class="token punctuation">)</span> <span class="token keyword">as</span> f<span class="token punctuation">:</span>
    f<span class="token punctuation">.</span>write<span class="token punctuation">(</span>time<span class="token punctuation">.</span>strftime<span class="token punctuation">(</span><span class="token string">"[%Y/%m/%d %H:%M:%S]"</span><span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token string">'\n'</span><span class="token punctuation">)</span>
    f<span class="token punctuation">.</span>write<span class="token punctuation">(</span>json<span class="token punctuation">.</span>dumps<span class="token punctuation">(</span>cookies<span class="token punctuation">,</span> sort_keys<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">,</span> indent<span class="token operator">=</span><span class="token number">4</span><span class="token punctuation">,</span> separators<span class="token operator">=</span><span class="token punctuation">(</span><span class="token string">','</span><span class="token punctuation">,</span> <span class="token string">':'</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token string">'\n'</span><span class="token punctuation">)</span>
    f<span class="token punctuation">.</span>write<span class="token punctuation">(</span>json<span class="token punctuation">.</span>dumps<span class="token punctuation">(</span>health<span class="token punctuation">.</span>json<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> sort_keys<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">,</span> indent<span class="token operator">=</span><span class="token number">4</span><span class="token punctuation">,</span> separators<span class="token operator">=</span><span class="token punctuation">(</span><span class="token string">','</span><span class="token punctuation">,</span> <span class="token string">':'</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token string">'\n'</span><span class="token punctuation">)</span>
    f<span class="token punctuation">.</span>close<span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre>
<p>以上代码理论上不会出现问题，但是由于每日打卡收到了时间限制，进行测试只能等第二天了。<br>第二天测试成功，已正常打卡， 现在剩下的问题就是如何”自动”了，这个问题对我来说不是问题，我之前租用了一个云服务器（详情见另一篇云服务器配置博客）  </p>
<h2 id="如何自动打卡"><a href="#如何自动打卡" class="headerlink" title="如何自动打卡"></a>如何自动打卡</h2><p>我的云服务器是ubuntu系统，他的定时任务是<code>crontab -e</code>，在里面按照以下格式写入<br><a target="_blank" rel="noopener" href="https://imgtu.com/i/IrosmR"><img src="https://z3.ax1x.com/2021/11/13/IrosmR.png" alt="IrosmR.png" loading="lazy"></a><br>退出时使用ctrl+x然后按y确认再按回车退出，更改后使用<code>service cron restart</code>重启定时任务，然后可以使用<code>service cron status</code>确定状态，状态如果是活跃就没问题了。<br>备选方案是使用手机安装Termux、Termux:Tasker、Tasker，然后在Termux中装载python3运行环境并安装相关包，利用Termux:Tasker每日自动执行，至于会不会涉及到锁屏的一些问题，因为博主没选择此方法，如果遇到其他问题，请自行解决   </p>
<h1 id="代码（3次改进）"><a href="#代码（3次改进）" class="headerlink" title="代码（3次改进）"></a>代码（3次改进）</h1><p>为什么上次代码已经能完成自动打卡了还改了一次呢，因为上次只能一个人打，这里稍作改动，可以一下完成多人打卡，并且修改了一下日志格式</p>
<pre class="language-python" data-language="python"><code class="language-python"><span class="token keyword">import</span> re
<span class="token keyword">import</span> requests
<span class="token keyword">import</span> os
<span class="token keyword">import</span> time
<span class="token keyword">import</span> sys
<span class="token keyword">import</span> json
<span class="token keyword">def</span> <span class="token function">main</span><span class="token punctuation">(</span>usr<span class="token punctuation">,</span>pwd<span class="token punctuation">)</span><span class="token punctuation">:</span>
    headers <span class="token operator">=</span> <span class="token punctuation">&#123;</span>
    <span class="token string">'user-agent'</span><span class="token punctuation">:</span> <span class="token string">'Dart/2.13 (dart:io)'</span><span class="token punctuation">,</span>
    <span class="token string">'content-type'</span><span class="token punctuation">:</span><span class="token string">'application/json; charset=utf-8'</span><span class="token punctuation">,</span>
    <span class="token string">'accept-encoding'</span><span class="token punctuation">:</span><span class="token string">'gzip'</span>
    <span class="token punctuation">&#125;</span>
    <span class="token comment">#此处依据你需要打卡的程序发送的json包改动</span>
    user <span class="token operator">=</span> <span class="token punctuation">&#123;</span><span class="token string">"username"</span><span class="token punctuation">:</span>usr<span class="token punctuation">,</span><span class="token string">"password"</span><span class="token punctuation">:</span>pwd<span class="token punctuation">,</span><span class="token string">"type"</span><span class="token punctuation">:</span><span class="token string">"student"</span><span class="token punctuation">&#125;</span>
    <span class="token comment"># 这里放入打卡信息，具体内容请自行拦截json</span>
    info <span class="token operator">=</span> <span class="token punctuation">&#123;</span><span class="token punctuation">&#125;</span>
    <span class="token comment">#以下两个url分别指向登录网页和打卡网页，具体可以在拦截的请求包中host+最上层的路径组合，这里为了保护个人隐私，将其删去</span>
    login_url <span class="token operator">=</span> <span class="token string">""</span>
    health_url <span class="token operator">=</span> <span class="token string">""</span>
    session <span class="token operator">=</span> requests<span class="token punctuation">.</span>session<span class="token punctuation">(</span><span class="token punctuation">)</span>
    login <span class="token operator">=</span> session<span class="token punctuation">.</span>post<span class="token punctuation">(</span>login_url<span class="token punctuation">,</span> json <span class="token operator">=</span> user<span class="token punctuation">,</span> headers <span class="token operator">=</span> headers<span class="token punctuation">)</span>
    cookies <span class="token operator">=</span> session<span class="token punctuation">.</span>cookies<span class="token punctuation">.</span>get_dict<span class="token punctuation">(</span><span class="token punctuation">)</span>
    health <span class="token operator">=</span> session<span class="token punctuation">.</span>post<span class="token punctuation">(</span>health_url<span class="token punctuation">,</span> json <span class="token operator">=</span> info<span class="token punctuation">,</span> headers <span class="token operator">=</span> headers<span class="token punctuation">)</span>
    log <span class="token operator">=</span> <span class="token string">"./log.txt"</span>
    <span class="token keyword">with</span> <span class="token builtin">open</span><span class="token punctuation">(</span>log<span class="token punctuation">,</span> <span class="token string">"a"</span><span class="token punctuation">)</span> <span class="token keyword">as</span> f<span class="token punctuation">:</span>
        f<span class="token punctuation">.</span>write<span class="token punctuation">(</span>time<span class="token punctuation">.</span>strftime<span class="token punctuation">(</span><span class="token string">"[%Y/%m/%d %H:%M:%S]"</span><span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token string">'\n'</span><span class="token punctuation">)</span>
        <span class="token keyword">try</span><span class="token punctuation">:</span>
            flag<span class="token operator">=</span>health<span class="token punctuation">.</span>json<span class="token punctuation">(</span><span class="token punctuation">)</span>
            <span class="token comment">#更改了一下原有的日志文件格式，根据响应包中的一个'sucess'键的值判断是否成功</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span>flag<span class="token punctuation">[</span><span class="token string">'success'</span><span class="token punctuation">]</span><span class="token operator">==</span><span class="token boolean">True</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
                f<span class="token punctuation">.</span>write<span class="token punctuation">(</span><span class="token string">"用户"</span><span class="token operator">+</span>usr<span class="token operator">+</span><span class="token string">"已打卡成功"</span> <span class="token operator">+</span> <span class="token string">'\n'</span><span class="token punctuation">)</span>
            <span class="token keyword">else</span><span class="token punctuation">:</span>
                <span class="token comment">#考虑到app如果更新了，json可能会改，这里记录一下</span>
                f<span class="token punctuation">.</span>write<span class="token punctuation">(</span><span class="token string">"app可能已更新，需重新更换json"</span> <span class="token operator">+</span> <span class="token string">'\n'</span><span class="token punctuation">)</span>
            f<span class="token punctuation">.</span>close<span class="token punctuation">(</span><span class="token punctuation">)</span>
        <span class="token keyword">except</span><span class="token punctuation">:</span>
            f<span class="token punctuation">.</span>write<span class="token punctuation">(</span><span class="token string">"用户"</span><span class="token operator">+</span>usr<span class="token operator">+</span><span class="token string">"打卡失败"</span> <span class="token operator">+</span> <span class="token string">'\n'</span><span class="token punctuation">)</span>
            f<span class="token punctuation">.</span>close<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token comment">#请使用main("","")方式调用打卡，需要给几个账号打卡就调用几个，第一个""为账号，另一个为密码</span></code></pre>
<p>缺点：如果打卡失败了目前是除了日志没有提示的，如果有空再补充根据日志文件检查是否打卡成功，如果不成功发送邮件提醒。  </p>
<h1 id="未知状况记录"><a href="#未知状况记录" class="headerlink" title="未知状况记录"></a>未知状况记录</h1><p>2021/11/26 未知原因打卡失败一天，日志文件未记录任何数据，怀疑是服务器本身因某种情况未执行python程序，先记录一下，如果以后再出现再找出原因<br>以上内容仅供技术交流，如因此产生任何纠纷，本人概不负责。</p>
</div><div id="reward-container"><span class="hty-icon-button button-glow" id="reward-button" title="打赏" onclick="var qr = document.getElementById(&quot;qr&quot;); qr.style.display = (qr.style.display === &quot;none&quot;) ? &quot;block&quot; : &quot;none&quot;;"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-hand-coin-line"></use></svg></span><div id="reward-comment">如果你认为本篇博客帮助到了你，你可以请我喝个可乐</div><div id="qr" style="display:none;"><div style="display:inline-block"><a href="/images/zhifubao.png"><img loading="lazy" src="/images/zhifubao.png" alt="支付宝" title="支付宝"></a><div><span style="color:#00A3EE"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-alipay-line"></use></svg></span></div></div><div style="display:inline-block"><a href="/images/qq.png"><img loading="lazy" src="/images/qq.png" alt="QQ 支付" title="QQ 支付"></a><div><span style="color:#12B7F5"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-qq-line"></use></svg></span></div></div><div style="display:inline-block"><a href="/images/wechat.png"><img loading="lazy" src="/images/wechat.png" alt="微信支付" title="微信支付"></a><div><span style="color:#2DC100"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-wechat-pay-line"></use></svg></span></div></div></div></div><ul class="post-copyright"><li class="post-copyright-author"><strong>本文作者：</strong>呆航</li><li class="post-copyright-link"><strong>本文链接：</strong><a href="http://lqh827821562.gitee.io/%E5%BC%80%E5%8F%91%E4%B8%80%E4%B8%AA%E8%87%AA%E5%8A%A8%E6%89%93%E5%8D%A1%E7%A8%8B%E5%BA%8F/" title="开发一个自动打卡程序">http://lqh827821562.gitee.io/%E5%BC%80%E5%8F%91%E4%B8%80%E4%B8%AA%E8%87%AA%E5%8A%A8%E6%89%93%E5%8D%A1%E7%A8%8B%E5%BA%8F/</a></li><li class="post-copyright-license"><strong>版权声明：</strong>本博客所有文章除特别声明外，均默认采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target="_blank" rel="noopener" title="CC BY-NC-SA 4.0 "><svg class="icon"><use xlink:href="#icon-creative-commons-line"></use></svg><svg class="icon"><use xlink:href="#icon-creative-commons-by-line"></use></svg><svg class="icon"><use xlink:href="#icon-creative-commons-nc-line"></use></svg><svg class="icon"><use xlink:href="#icon-creative-commons-sa-line"></use></svg></a> 许可协议。</li></ul></section></article><div class="post-nav"><div class="post-nav-item"><a class="post-nav-prev" href="/%E7%A0%B4%E8%A7%A3%E5%A4%A7%E4%BD%AC%E5%8D%9A%E5%AE%A2%E7%9A%84%E5%85%A5%E7%AB%99%E5%AF%86%E7%A0%81/" rel="prev" title="破解大佬博客的入站密码"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-arrow-left-s-line"></use></svg><span class="post-nav-text">破解大佬博客的入站密码</span></a></div><div class="post-nav-item"><a class="post-nav-next" href="/win11%E7%9A%84windows%20defender%E6%97%A0%E6%B3%95%E4%BD%BF%E7%94%A8%E9%97%AE%E9%A2%98/" rel="next" title="win11的Windows defender无法使用问题"><span class="post-nav-text">win11的Windows defender无法使用问题</span><svg class="icon" aria-hidden="true"><use xlink:href="#icon-arrow-right-s-line"></use></svg></a></div></div></div><div class="hty-card" id="comment"><div id="valine-container"></div><script>Yun.utils.getScript("https://cdn.jsdelivr.net/npm/valine@latest/dist/Valine.min.js", () => {
  const valineConfig = {"enable":true,"appId":"k8weiJIG9u6tXEjf9jL8pvQN-MdYXbMMI","appKey":"JtLQP97hURfluJNL00DMe8gl","placeholder":"Just go go","avatar":null,"pageSize":10,"visitor":false,"highlight":true,"recordIP":false,"enableQQ":true,"meta":["nick","mail","link"],"el":"#valine-container","lang":"zh-cn"}
  valineConfig.path = "/%E5%BC%80%E5%8F%91%E4%B8%80%E4%B8%AA%E8%87%AA%E5%8A%A8%E6%89%93%E5%8D%A1%E7%A8%8B%E5%BA%8F/"
  new Valine(valineConfig)
}, window.Valine);</script></div></main><footer class="sidebar-translate" id="footer"><div class="copyright"><span>&copy; 2019 – 2022 </span><span class="with-love" id="animate"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-cloud-line"></use></svg></span><span class="author"> 呆航</span></div><div class="powered"><span>由 <a href="https://hexo.io" target="_blank" rel="noopener">Hexo</a> 驱动 v5.2.0</span><span class="footer-separator">|</span><span>主题 - <a rel="noopener" href="https://github.com/YunYouJun/hexo-theme-yun" target="_blank"><span>Yun</span></a> v1.7.0</span></div><div class="live_time"><span>本博客已萌萌哒地运行</span><span id="display_live_time"></span><span class="moe-text">(●'◡'●)</span><script>function blog_live_time() {
  setTimeout(blog_live_time, 1000);
  const start = new Date('2021-05-17T00:00:00');
  const now = new Date();
  const timeDiff = (now.getTime() - start.getTime());
  const msPerMinute = 60 * 1000;
  const msPerHour = 60 * msPerMinute;
  const msPerDay = 24 * msPerHour;
  const passDay = Math.floor(timeDiff / msPerDay);
  const passHour = Math.floor((timeDiff % msPerDay) / 60 / 60 / 1000);
  const passMinute = Math.floor((timeDiff % msPerHour) / 60 / 1000);
  const passSecond = Math.floor((timeDiff % msPerMinute) / 1000);
  display_live_time.innerHTML = " " + passDay + " 天 " + passHour + " 小时 " + passMinute + " 分 " + passSecond + " 秒";
}
blog_live_time();
</script></div><div id="busuanzi"><span id="busuanzi_container_site_uv" title="总访客量"><span><svg class="icon" aria-hidden="true"><use xlink:href="#icon-user-line"></use></svg></span><span id="busuanzi_value_site_uv"></span></span><span class="footer-separator">|</span><span id="busuanzi_container_site_pv" title="总访问量"><span><svg class="icon" aria-hidden="true"><use xlink:href="#icon-eye-line"></use></svg></span><span id="busuanzi_value_site_pv"></span></span><script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></footer><a class="hty-icon-button" id="back-to-top" aria-label="back-to-top" href="#"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-arrow-up-s-line"></use></svg><svg class="progress-circle-container" viewBox="0 0 100 100"><circle class="progress-circle" id="progressCircle" cx="50" cy="50" r="48" fill="none" stroke="#0078E7" stroke-width="2" stroke-linecap="round"></circle></svg></a><a class="popup-trigger hty-icon-button icon-search" id="search" href="javascript:;" title="搜索"><span class="site-state-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-search-line"></use></svg></span></a><script>window.addEventListener("DOMContentLoaded", () => {
  // Handle and trigger popup window
  document.querySelector(".popup-trigger").addEventListener("click", () => {
    document.querySelector(".popup").classList.add("show");
    setTimeout(() => {
      document.querySelector(".search-input").focus();
    }, 100);
  });

  // Monitor main search box
  const onPopupClose = () => {
    document.querySelector(".popup").classList.remove("show");
  };

  document.querySelector(".popup-btn-close").addEventListener("click", () => {
    onPopupClose();
  });

  window.addEventListener("keyup", event => {
    if (event.key === "Escape") {
      onPopupClose();
    }
  });
});
</script><script defer src="https://cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js"></script><script defer src="https://cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js"></script><script defer src="/js/search/algolia-search.js"></script><div class="popup search-popup"><div class="search-header"><span class="popup-btn-close close-icon hty-icon-button"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-close-line"></use></svg></span></div><div class="search-input-container"></div><div class="algolia-results"><div id="algolia-stats"></div><div id="algolia-hits"></div><div class="algolia-pagination" id="algolia-pagination"></div></div></div></div></body></html>